home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / Aliases.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  5.8 KB  |  158 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Aliases.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __ALIASES__
  18. #define __ALIASES__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __APPLETALK__
  27. #include <AppleTalk.h>
  28. #endif
  29. /*    #include <OSUtils.h>                                        */
  30. /*        #include <MixedMode.h>                                    */
  31. /*        #include <Memory.h>                                        */
  32.  
  33. #ifndef __FILES__
  34. #include <Files.h>
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if GENERATINGPOWERPC
  42. #pragma options align=mac68k
  43. #endif
  44.  
  45. #ifdef __CFM68K__
  46. #pragma lib_export on
  47. #endif
  48.  
  49.  
  50. enum {
  51.     rAliasType                    = 'alis',                        /* Aliases are stored as resources of this type */
  52. /* define alias resolution action rules mask */
  53.     kARMMountVol                = 0x00000001,                    /* mount the volume automatically */
  54.     kARMNoUI                    = 0x00000002,                    /* no user interface allowed during resolution */
  55.     kARMMultVols                = 0x00000008,                    /* search on multiple volumes */
  56.     kARMSearch                    = 0x00000100,                    /* search quickly */
  57.     kARMSearchMore                = 0x00000200,                    /* search further */
  58.     kARMSearchRelFirst            = 0x00000400,                    /* search target on a relative path first */
  59. /* define alias record information types */
  60.     asiZoneName                    = -3,                            /* get zone name */
  61.     asiServerName                = -2,                            /* get server name */
  62.     asiVolumeName                = -1,                            /* get volume name */
  63.     asiAliasName                = 0,                            /* get aliased file/folder/volume name */
  64.     asiParentName                = 1                                /* get parent folder name */
  65. };
  66.  
  67. /* define the alias record that will be the blackbox for the caller */
  68. struct AliasRecord {
  69.     OSType                            userType;                    /* appl stored type like creator type */
  70.     unsigned short                    aliasSize;                    /* alias record size in bytes, for appl usage */
  71. };
  72. typedef struct AliasRecord AliasRecord;
  73.  
  74. typedef AliasRecord *AliasPtr, **AliasHandle;
  75.  
  76. /* alias record information type */
  77. typedef short AliasInfoType;
  78.  
  79. typedef pascal Boolean (*AliasFilterProcPtr)(CInfoPBPtr cpbPtr, Boolean *quitFlag, Ptr myDataPtr);
  80.  
  81. #if GENERATINGCFM
  82. typedef UniversalProcPtr AliasFilterUPP;
  83. #else
  84. typedef AliasFilterProcPtr AliasFilterUPP;
  85. #endif
  86.  
  87. enum {
  88.     uppAliasFilterProcInfo = kPascalStackBased
  89.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  90.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(CInfoPBPtr)))
  91.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean*)))
  92.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Ptr)))
  93. };
  94.  
  95. #if GENERATINGCFM
  96. #define NewAliasFilterProc(userRoutine)        \
  97.         (AliasFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAliasFilterProcInfo, GetCurrentArchitecture())
  98. #else
  99. #define NewAliasFilterProc(userRoutine)        \
  100.         ((AliasFilterUPP) (userRoutine))
  101. #endif
  102.  
  103. #if GENERATINGCFM
  104. #define CallAliasFilterProc(userRoutine, cpbPtr, quitFlag, myDataPtr)        \
  105.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAliasFilterProcInfo, (cpbPtr), (quitFlag), (myDataPtr))
  106. #else
  107. #define CallAliasFilterProc(userRoutine, cpbPtr, quitFlag, myDataPtr)        \
  108.         (*(userRoutine))((cpbPtr), (quitFlag), (myDataPtr))
  109. #endif
  110.  
  111. extern pascal OSErr NewAlias(ConstFSSpecPtr fromFile, const FSSpec *target, AliasHandle *alias)
  112.  TWOWORDINLINE(0x7002, 0xA823);
  113. /* create a minimal new alias for a target and return alias record handle */
  114. extern pascal OSErr NewAliasMinimal(const FSSpec *target, AliasHandle *alias)
  115.  TWOWORDINLINE(0x7008, 0xA823);
  116. /* create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  */
  117. extern pascal OSErr NewAliasMinimalFromFullPath(short fullPathLength, const void *fullPath, ConstStr32Param zoneName, ConstStr31Param serverName, AliasHandle *alias)
  118.  TWOWORDINLINE(0x7009, 0xA823);
  119. /* given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. */
  120. extern pascal OSErr ResolveAlias(ConstFSSpecPtr fromFile, AliasHandle alias, FSSpec *target, Boolean *wasChanged)
  121.  TWOWORDINLINE(0x7003, 0xA823);
  122. /* given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. */
  123. extern pascal OSErr GetAliasInfo(AliasHandle alias, AliasInfoType index, Str63 theString)
  124.  TWOWORDINLINE(0x7007, 0xA823);
  125. /* 
  126.   Given a file spec, return target file spec if input file spec is an alias.
  127.   It resolves the entire alias chain or one step of the chain.  It returns
  128.   info about whether the target is a folder or file; and whether the input
  129.   file spec was an alias or not. 
  130. */
  131. extern pascal OSErr ResolveAliasFile(FSSpec *theSpec, Boolean resolveAliasChains, Boolean *targetIsFolder, Boolean *wasAliased)
  132.  TWOWORDINLINE(0x700C, 0xA823);
  133. extern pascal OSErr FollowFinderAlias(ConstFSSpecPtr fromFile, AliasHandle alias, Boolean logon, FSSpec *target, Boolean *wasChanged)
  134.  TWOWORDINLINE(0x700F, 0xA823);
  135. /* 
  136.    Low Level Routines 
  137.  Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag
  138. */
  139. extern pascal OSErr MatchAlias(ConstFSSpecPtr fromFile, unsigned long rulesMask, AliasHandle alias, short *aliasCount, FSSpecArrayPtr aliasList, Boolean *needsUpdate, AliasFilterUPP aliasFilter, void *yourDataPtr)
  140.  TWOWORDINLINE(0x7005, 0xA823);
  141. /* given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. */
  142. extern pascal OSErr UpdateAlias(ConstFSSpecPtr fromFile, const FSSpec *target, AliasHandle alias, Boolean *wasChanged)
  143.  TWOWORDINLINE(0x7006, 0xA823);
  144.  
  145. #ifdef __CFM68K__
  146. #pragma lib_export off
  147. #endif
  148.  
  149. #if GENERATINGPOWERPC
  150. #pragma options align=reset
  151. #endif
  152.  
  153. #ifdef __cplusplus
  154. }
  155. #endif
  156.  
  157. #endif /* __ALIASES__ */
  158.